#!/bin/bash

workdir=`pwd`
hygon_build_dir="${workdir}/build"
processor_num=`cat /proc/cpuinfo | grep processor | grep -v grep | wc -l`

#options="-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${hygon_build_dir}/install $*"
options="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${hygon_build_dir}/install $* -DONEDNN_ENABLE_GRAPH_DUMP=ON"

export CC=/tools/speccpu/compiler/gcc-8.2.0-static/bin/gcc
export CXX=/tools/speccpu/compiler/gcc-8.2.0-static/bin/g++
#export CC=/opt/HygonCC/1.1/bin/clang
#export CXX=/opt/HygonCC/1.1/bin/clang++

mkdir ${hygon_build_dir}
cd ${hygon_build_dir}
cmd="cmake $options .. && make -j${processor_num} && make install"
echo "cmd -> $cmd"
eval "$cmd"
